import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';
/* Layout */
import Layout from '@/layout/index.vue';
// import Home from '../views/Home.vue';

export const routes: Array<RouteRecordRaw> = [
  {
    path: '/login',
    name: 'Login',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "login" */ '@/views/common/Login.vue'),

    meta: { title: '' },
    props: {},
    children: [],
    // redirect: '',
    // alias: '',
    // beforeEnter: undefined,
  },
  {
    path: '/404',
    name: 'NotFound',
    component: () => import(/* webpackChunkName: "error-page" */ '@/views/common/ErrorPage.vue'),
    props: {
      type: '404',
    },
  },
  {
    path: '/401',
    name: 'NoAuth',
    component: () => import(/* webpackChunkName: "error-page" */ '@/views/common/ErrorPage.vue'),
    props: {
      type: '401',
    },
  },
  {
    path: '/help',
    name: 'Help',
    component: () => import(/* webpackChunkName: "help" */ '@/views/common/Help.vue'),
  },
  {
    path: '/icon-list',
    name: 'IconList',
    component: () => import(/* webpackChunkName: "icon-list" */ '@/views/common/IconList.vue'),
  },
  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    children: [
      {
        path: 'dashboard', // 首页
        component: () => import('@/views/dashboard/index.vue'),
        name: 'Dashboard',
        meta: { title: 'Dashboard', icon: 'dashboard', affix: true },
      },
    ],
  },
];

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes,
  // scrollBehavior: () => ({ y: 0 }),
});

console.log(63, router.getRoutes());

export default router;
